package cate.common.table.dynins;


import cate.common.annotation.SplitParse;
import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cate.common.util.SplitParser;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.List;

@NoteClass("英雄等级")
public class DynHeroLevelRow extends ERow {

    @NoteField("装备")
    private String equipCode;

    @NoteField("宝石")
    private String gemCode;

    @NoteField("徽章")
    public int runeCode;

    @NoteField("星格")
    public int spiceCode;

    @NoteField("天赋")
    public int talentCode;

    @NoteField("手办")
    public int furnitureCode;

    @NoteField("灵器")
    public int fairyCode;

    @NoteField("好感")
    public String favorableCode;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("等级", -1);
        this.equipCode = xrw.getString("装备");
        this.gemCode = xrw.getString("宝石");
        this.runeCode = xrw.getInteger("徽章", -1);
        this.spiceCode = xrw.getInteger("星格", -1);
        this.talentCode = xrw.getInteger("天赋", -1);
        this.furnitureCode = xrw.getInteger("手办", -1);
        this.fairyCode = xrw.getInteger("灵器", -1);
        this.favorableCode = xrw.getString("好感");
    }

    // 位置:装备id:是否拓印
    public static class EquipConfig {
        @SplitParse(order = 0, defaultValue = "1", note = "位置")
        public byte pos;

        @SplitParse(order = 1, defaultValue = "1", note = "装备id")
        public int tid;

        @SplitParse(order = 2, defaultValue = "0", note = "是否拓印")
        public boolean campMark;
    }

    // 位置:宝石id
    public static class GemConfig {
        @SplitParse(order = 0, defaultValue = "1", note = "位置")
        public byte pos;

        @SplitParse(order = 1, defaultValue = "1", note = "宝石id")
        public int tid;
    }

    public List<EquipConfig> equipConfigs;

    public List<GemConfig> gemConfigs;


    @Override
    public void decode() {
        equipConfigs = SplitParser.parse(EquipConfig.class, equipCode);
        gemConfigs = SplitParser.parse(GemConfig.class, gemCode);

    }
}
